	<!-- some initial settings -->
		webcam.set_api_url( 'test.php' );	//set the page which recieves the file
		webcam.set_quality( 90 ); // JPEG quality (1 - 100)
		webcam.set_shutter_sound( false ); // play shutter click sound


	<!-- Code to handle the server response (see test.php) -->
		webcam.set_hook( 'onComplete', 'my_completion_handler' );
		
		function take_snapshot() {
			// take snapshot and upload to server
			document.getElementById('upload_results').innerHTML = '<h1>Uploading...</h1>';
			webcam.snap();
		}
		
		function do_upload() {
			// upload to server
			document.getElementById('upload_results').innerHTML = '<h1>Uploading...</h1>';
			webcam.upload();
		}
		
		function my_completion_handler(msg) {
			// extract URL out of PHP output
			if (msg.match(/(http\:\/\/\S+)/)) {
				var image_url = RegExp.$1;
				// show JPEG image in page
				document.getElementById('upload_results').innerHTML = 
					'<h2>Upload Successful!</h1>' + 
					'<h4>JPEG URL: ' + image_url + '</h4>' + 
					'<img src="' + image_url + '">';
				
				// reset camera for another shot or can be freezed
				webcam.reset();
				webcam.freeze();
			}
			else alert("PHP Error: " + msg);
		}

